package com.fa4j.system.account.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.Fastjson2TypeHandler;
import com.fa4j.common.data.model.Base;
import com.fa4j.common.web.model.AppType;
import com.fa4j.system.login.model.LoginType;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
 * 账号绑定表
 *
 * @since 2025-05-06 16:16:26
 */
@Data
@TableName("t_sys_account_bind")
@Schema(description = "账号绑定")
public class AccountBind extends Base {

    @Schema(description = "主键")
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @Schema(description = "应用类型")
    private AppType appType;

    @Schema(description = "账号ID")
    private Long accountId;

    @Schema(description = "绑定类型")
    private LoginType type;

    @Schema(description = "绑定类型名称")
    public String getTypeName() {
        return type != null ? type.getName() : null;
    }

    @Schema(description = "三方应用ID")
    private String thirdAppId;

    @Schema(description = "三方账户唯一ID")
    private String thirdOpenId;

    @Schema(description = "三方账户平台唯一ID")
    private String thirdUnionId;

    @Schema(description = "操作人ID")
    private Long operatorId;

    @JsonIgnore
    @Schema(description = "扩展信息", hidden = true)
    @TableField(typeHandler = Fastjson2TypeHandler.class)
    private AccountBindExt ext;


}
